from selenium.webdriver.common.by import By
from pages.base_page import BasePage
class ClueTransformPage(BasePage):
    """线索-转换页面做的操作"""
    input_postcode_nofoursix_locator=(By.CSS_SELECTOR,'#zip_code')
    click_sava_locator = (By.CSS_SELECTOR, '#form1 > table > tfoot > tr > td > input:nth-child(1)')
    transform_sucessful_tips_locator=(By.CSS_SELECTOR,'body > div.container > div.alert.alert-success')
    edit_client_name_locator=(By.CSS_SELECTOR,'#name')

    def input_postcode_nofoursix(self,postcode):
        """# 填写邮编为非四级六位编码制"""
        self.driver.find_element(*self.input_postcode_nofoursix_locator).send_keys(postcode)

    def click_save_transform(self):
        """# 点击保存"""
        self.driver.find_element(*self.click_sava_locator).click()

    def edit_client_name(self,clicent_name):
        """ #更换客户名"""
        self.driver.find_element(*self.edit_client_name_locator).send_keys(clicent_name)

    def transform_successful_tips(self):
        """#断言 转换成功"""
        transform_successful_tips=self.driver.find_element(*self.transform_sucessful_tips_locator).text
        return transform_successful_tips